Ext.define('HRMobile.model.Language', {
    extend: 'Ext.data.Model',
    config: {
     fields: ['languageName',
              'readingLevel',
              'speakingLevel',
              'writingLevel',
              'listeningLevel',
              'comments',
              {name: 'readingLevelText',
            	  convert: function(value, record) {
            		  return convertValueIntoText(record.get('readingLevel'));
            		}
              },
    		  {name: 'speakingLevelText',
              	  convert: function(value, record) {
              		  return convertValueIntoText(record.get('speakingLevel'));
              		}
              },
    		  {name: 'writingLevelText',
              	  convert: function(value, record) {
              		  return convertValueIntoText(record.get('writingLevel'));
              		}
              },
    		  {name: 'listeningLevelText',
              	  convert: function(value, record) {
              		  return convertValueIntoText(record.get('listeningLevel'));
              		}
              }
              ]
    }
});
var convertValueIntoText = function(level){
	 switch(level)
     {
	     case 0:
	       return 'Fundamental';
	       break;
	     case 1:
	       return 'Pre-intermediate';
	       break;
	     case 2:
	    	 return 'Intermediate';
	    	 break;
	     case 3:
	    	 return 'Upper-intermediate';
	    	 break;
	     case 4:
	    	 return 'Advanced';
	    	 break;
    	 default:
	    	return 'N/A';
    	 	break;
	 }
};